pchCfg = pchCfg or {}


pchCfg.item = {
	ChangWanLiBao = {
					key = "ChangWanLiBao",
					desc = "畅玩礼包",
					price = "1000",
					processOk = function()
						AudioEngine.playEffect(sound.fuhuo)
						userData.fulllives = pp.lives_fullcnt_high
						userData.lives = userData.fulllives
						

						if DEF_VER_CHJIE_20150124 then --畅捷包特殊道具
							userData.weaponCnt_fenji = userData.weaponCnt_fenji + 8
							userData.weaponCnt_yuheng = userData.weaponCnt_yuheng + 8
							userData.coin = userData.coin + 888
						else 							--std version
							userData.weaponCnt_fenji = userData.weaponCnt_fenji + 6
							userData.weaponCnt_yuheng = userData.weaponCnt_yuheng + 6
							userData.coin = userData.coin + 680
						end

						local scene = gameUtil.curLuaScene

						if scene.class.__cname == "LevelScene" then

							scene:refreshLiveCnt()
							scene:refreshCoin(userData.coin)
							
							scene.bt_libao:removeFromParent(true)

							uiPopNotify:popString(scene.widget, "获得畅玩礼包")
							
							scene.pchPanel:close()
							scene.pchPanel = nil

						elseif scene.class.__cname == "GameScene" then

							scene:refreshCoin()
							scene:refreshWeaponCnt()
							--uiPopNotify:popString(scene.widget, "畅玩礼包购买成功")
							
							scene.pchPanel:close()
							scene.pchPanel = nil

							if gameData.status == pp.gamestate_fail then
				                if userData.spe_freeFuhuoLeft == 0 then
				                    WarningPanel.create(scene, "Pay_game_Libao_Fuhuo")
				                else
				                    scene:wrapper_WarningPanel_create_freeFuhuo()
				                end
					        else
                                scene:game_win(0)
					        end
						end

						gameUtil.flushUserRecord()

						gameUtil.sendGameStat(et.Buy_ChangWanLiBao, #userData.passedlevelinfo)
					end,

					processFail = function()
						gameUtil.curLuaScene.pchPanel:close()
						gameUtil.curLuaScene.pchPanel = nil
						uiPopNotify:popString(gameUtil.curLuaScene.widget, "支付失败,请稍后再试")

						local scene = gameUtil.curLuaScene
						if scene.class.__cname == "GameScene" then
							if gameData.status == pp.gamestate_fail then
				                if userData.spe_freeFuhuoLeft == 0 then
				                    WarningPanel.create(scene, "Pay_game_Libao_Fuhuo")
				                else
				                    WarningPanel.create(scene, "GameScene_freeFuhuo")
				                end
					        else
					            scene:game_win(0)
					        end
					    end
					end,
				},

	TiLiBuMan = {
					key = "TiLiBuMan",
					desc = "体力补满",
					price = "400",
					processOk = function()
						AudioEngine.playEffect(sound.fuhuo)
						userData.lives = userData.fulllives

						local levelscene = gameUtil.curLuaScene
						levelscene:refreshLiveCnt()
						gameUtil.flushUserRecord()

						uiPopNotify:popString(levelscene.widget, "体力已补满")

						levelscene.pchPanel:close()
						levelscene.pchPanel = nil

						gameUtil.sendGameStat(et.Buy_TiLiBuMan, #userData.passedlevelinfo)
					end,

					processFail = function()
						gameUtil.curLuaScene.pchPanel:close()
						gameUtil.curLuaScene.pchPanel = nil
						uiPopNotify:popString(gameUtil.curLuaScene.widget, "支付失败,请稍后再试")
					end,
				},

	FuHuo = {
					key = "FuHuo",
					desc = "复活",
					price = "400",
					processOk = function()
						AudioEngine.playEffect(sound.fuhuo)
						
						userData.weaponCnt_fenji = userData.weaponCnt_fenji + 2
						userData.coin = userData.coin + 258
						gameUtil.flushUserRecord()
						local gamescene = gameUtil.curLuaScene
						gamescene:onGameFuhuo()
						gamescene:refreshWeaponCnt()
						gamescene:refreshCoin()

						uiPopNotify:popString(gamescene.widget, "获得金币258枚,焚寂2个")

						gamescene.pchPanel:close()
						gamescene.pchPanel = nil

						gameUtil.sendGameStat(et.Buy_FuHuo, gameData.level)
					end,

					processFail = function()
						gameUtil.curLuaScene:game_fail()
						gameUtil.curLuaScene.pchPanel:close()
						gameUtil.curLuaScene.pchPanel = nil
						uiPopNotify:popString(gameUtil.curLuaScene.widget, "支付失败,请稍后再试")
					end,
				},

	JinBi_680 = {
					key = "JinBi_680",
					desc = "金币680枚",
					price = "400",
					processOk = function()
						AudioEngine.playEffect(sound.fuhuo)
						gameUtil.buyCoin(680)
						local levelscene = gameUtil.curLuaScene
						levelscene:refreshCoin(userData.coin)

						uiPopNotify:popString(levelscene.widget, "获得金币680枚")

						gameUtil.sendGameStat(et.Buy_JinBi_680, #userData.passedlevelinfo)
					end,

					processFail = function()
						uiPopNotify:popString(gameUtil.curLuaScene.widget, "支付失败,请稍后再试")
					end,
				},

	JinBi_1680 = {
					key = "JinBi_1680",
					desc = "金币1680枚",
					price = "800",
					processOk = function()
						AudioEngine.playEffect(sound.fuhuo)
						gameUtil.buyCoin(1680)
						gameUtil.curLuaScene:refreshCoin(userData.coin)

						uiPopNotify:popString(gameUtil.curLuaScene.widget, "获得金币1680枚")

						gameUtil.sendGameStat(et.Buy_JinBi_1680, #userData.passedlevelinfo)
					end,

					processFail = function()
						uiPopNotify:popString(gameUtil.curLuaScene.widget, "支付失败,请稍后再试")
					end,
				},

	JinBi_3980 = {
					key = "JinBi_3980",
					desc = "金币3980枚",
					price = "1600",
					processOk = function()
						AudioEngine.playEffect(sound.fuhuo)
						gameUtil.buyCoin(3980)
						gameUtil.curLuaScene:refreshCoin(userData.coin)

						uiPopNotify:popString(gameUtil.curLuaScene.widget, "获得金币3980枚")

						gameUtil.sendGameStat(et.Buy_JinBi_3980, #userData.passedlevelinfo)
					end,

					processFail = function()
						uiPopNotify:popString(gameUtil.curLuaScene.widget, "支付失败,请稍后再试")
					end,
				},

	FenJi_10 = {
					key = "FenJi_10",
					desc = "焚寂10个",
					price = "600",
					processOk = function()
						AudioEngine.playEffect(sound.fuhuo)
						userData.weaponCnt_fenji = userData.weaponCnt_fenji + 10
						gameUtil.flushUserRecord()
                        local gamescene = gameUtil.curLuaScene
						gamescene:refreshWeaponCnt()
						gamescene:game_resume_callback()

						uiPopNotify:popString(gamescene.widget, "获得焚寂10个")

						gamescene.pchPanel:close()
						gamescene.pchPanel = nil

						gameUtil.sendGameStat(et.Buy_FenJi_10, #userData.passedlevelinfo)
					end,

					processFail = function()
						gameUtil.curLuaScene:game_resume_callback()
						gameUtil.curLuaScene.pchPanel:close()
						gameUtil.curLuaScene.pchPanel = nil
						uiPopNotify:popString(gameUtil.curLuaScene.widget, "支付失败,请稍后再试")

					end,
				},

	YuHeng_10 = {
					key = "YuHeng_10",
					desc = "玉衡10个",
					price = "600",
					processOk = function()
						AudioEngine.playEffect(sound.fuhuo)
						userData.weaponCnt_yuheng = userData.weaponCnt_yuheng + 10
						gameUtil.flushUserRecord()
						local gamescene = gameUtil.curLuaScene
						gamescene:refreshWeaponCnt()
						gamescene:game_resume_callback()
						
						uiPopNotify:popString(gamescene.widget, "获得玉衡10个")

						gamescene.pchPanel:close()
						gamescene.pchPanel = nil

						gameUtil.sendGameStat(et.Buy_YuHeng_10, #userData.passedlevelinfo)
					end,

					processFail = function()
						gameUtil.curLuaScene:game_resume_callback()
						gameUtil.curLuaScene.pchPanel:close()
						gameUtil.curLuaScene.pchPanel = nil
						uiPopNotify:popString(gameUtil.curLuaScene.widget, "支付失败,请稍后再试")
					end,
				},

		FuHuoLiBao = {
					key = "FuHuoLiBao",
					desc = "复活礼包",
					price = "2000",
					processOk = function()
						AudioEngine.playEffect(sound.fuhuo)
						
						--debug assert
						-- if userData.spe_bought_doubleFuhuoLibao < #pp.spe_doubleFuhuoTrapTimes then
						-- 	userData.spe_bought_doubleFuhuoLibao = userData.spe_bought_doubleFuhuoLibao + 1
						-- 	gameUtil.flushUserRecord()
						-- else
						-- 	uiPopNotify:popString(gameUtil.curLuaScene.widget, "assert:huofuo")
						-- end
						userData.spe_bought_doubleFuhuoLibao = userData.spe_bought_doubleFuhuoLibao + 1
						
						local tmpIdx
						if userData.spe_bought_doubleFuhuoLibao > #pp.spe_FuhuoLiBao_freeFuhuoTimes then
							tmpIdx = #pp.spe_FuhuoLiBao_freeFuhuoTimes
						else
							tmpIdx = userData.spe_bought_doubleFuhuoLibao
						end

						local freeFuhuoTimes = pp.spe_FuhuoLiBao_freeFuhuoTimes[tmpIdx]

						userData.spe_freeFuhuoLeft = userData.spe_freeFuhuoLeft + freeFuhuoTimes
						
						if DEF_VER_CHJIE_20150124 then --畅捷包特殊道具
							userData.coin = userData.coin + 2888
						end

						gameUtil.flushUserRecord()

						local gamescene = gameUtil.curLuaScene
						gamescene:onGameFuhuo()

						gamescene.pchPanel:close()
						gamescene.pchPanel = nil

                        uiPopNotify:popString(gamescene.widget, "获得复活礼包")
						gameUtil.sendGameStat(et.Buy_FuHuoLiBao, #userData.passedlevelinfo)
					end,

					processFail = function()
						gameUtil.curLuaScene:game_fail()
						gameUtil.curLuaScene.pchPanel:close()
						gameUtil.curLuaScene.pchPanel = nil
						uiPopNotify:popString(gameUtil.curLuaScene.widget, "支付失败,请稍后再试")
					end,
				},

		JinBiLiBao = {
					key = "JinBiLiBao",
					desc = "金币礼包",
					price = "1200",
					processOk = function()
						AudioEngine.playEffect(sound.fuhuo)
						gameUtil.buyCoin(6888)
						gameUtil.curLuaScene:refreshCoin(userData.coin)

						uiPopNotify:popString(gameUtil.curLuaScene.widget, "获得金币6888枚")

						local levelscene = gameUtil.curLuaScene
						levelscene.pchPanel:close()
						levelscene.pchPanel = nil

						gameUtil.sendGameStat(et.Buy_JinBiLiBao, #userData.passedlevelinfo)
					end,

					processFail = function()
						gameUtil.curLuaScene.pchPanel:close()
						gameUtil.curLuaScene.pchPanel = nil
						uiPopNotify:popString(gameUtil.curLuaScene.widget, "支付失败,请稍后再试")
					end,
				},

		XinShouLiBao = {
					key = "XinShouLiBao",
					desc = "新手礼包",
					price = "1000",
					processOk = function()
						AudioEngine.playEffect(sound.fuhuo)

						--lkj notify: 2015/2/11 
						--双存档如果在同一个函数内进行2次写入，那么最后修改时间（如果是精确到秒，那么会导致下次读取的时候读取到一个实际写入时间较早的那个档，引发bug）
						--所以这里必须高度注意该问题！！  
						--如果是精确到微秒，那么可能是正确的，总之尽量避免在短时间内连续存储有变化的档！！！
						userData.bought_xinshoulibao = true
						gameUtil.buyCoin(188)
						gameUtil.curLuaScene:refreshCoin(userData.coin)

						uiPopNotify:popString(gameUtil.curLuaScene.widget, "获得金币188枚")	
						
						
						local levelscene = gameUtil.curLuaScene
						levelscene.pchPanel:close()
						levelscene.pchPanel = nil

						levelscene.bt_xinshou_libao:setVisible(false)
					end,

					processFail = function()
						gameUtil.curLuaScene.pchPanel:close()
						gameUtil.curLuaScene.pchPanel = nil
						uiPopNotify:popString(gameUtil.curLuaScene.widget, "支付失败,请稍后再试")
					end,
				},


}

pchCfg.channel = {
	mm = {file = "purchase/pch_mm"},
	cte = {file = "purchase/pch_cte"},
	uni = {file = "purchase/pch_uni"},

	glt = {file = "purchase/pch_glt"},
}
